<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<title>门店列表</title>
<link rel="stylesheet" type="text/css" href="/css/reset.css" />
<link rel="stylesheet" type="text/css" href="/css/common.css" />
<link rel="stylesheet" type="text/css" href="/css/thems.css">
<link rel="stylesheet" type="text/css" href="/css/color.css" />
<link rel="stylesheet" type="text/css" href="/css/bootStrap.min.css" />

<script type="text/javascript" src="/js/jquery-3.2.1.js"></script>
<script type="text/javascript">
	$(function() {
		//自适应屏幕宽度
		window.onresize = function() {
			location = location
		};

		var main_h = $(window).height();
		$('.hy_list').css('height', main_h - 45 + 'px');

		var search_w = $(window).width() - 40;
		$('.search').css('width', search_w + 'px');
		//$('.list_hy').css('width',search_w+'px');
	});
</script>
<!--框架高度设置-->
</head>

<body>
	<div id="right_ctn ">
		<div class="right_m ">
			<!--会议列表-->
			<div class="hy_list ">
				<div class="box_t ">
					<span class="name ">优惠卷列表</span>

				</div>
				<!--查询--> 
				<form action="/lahuocar/orderselect" class="navbar-form navbar-left"
					method="post ">
					&nbsp;&nbsp; <select class="form-control startProvince"
						name="carid">
						<option value="0">请选择车型</option>
						<#list carlist as carlists>
						<option value="${carlists.id}">${carlists.carname}</option>
						</#list>
					

					</select> &nbsp;&nbsp; <select class="form-control stopProvince"
						name="state">
						
						<option value="0">请选择订单状态</option>
						
						<option value="1">已完成</option>
						<option value="2">已付款</option>
						<option value="3">带付款</option>
					
				
					</select> &nbsp;&nbsp;&nbsp;&nbsp;
					<div class="input-group">
						<input type="submit" class="btn btn-primary" name="" id=""
							value="查询" />
					</div>
				</form>
				<!--添加 start-->

				<ul class="list-inline">
					<li class="margin-top pull-right">
						<button class="btn btn-primary add" data-toggle="modal"
							data-target="#modal-add" data-backdrop="static">
							<span class="glyphicon glyphicon-plus"></span>&nbsp;添加
						</button> <!--添加模态框--> <!--添加模态框-->
					</li>
				</ul>

				<!--添加 end-->
				<!--查询-->
				<div class="space_hx ">&nbsp;</div>
				<!--列表-->
				<table class="col-md-11 table table-hover text-center">
					<tr class="bg-hui ">
						<td>订单编号</td>
						<td>车辆名称</td>
						<td>会员名</td>
						<td>收货人</td>
						<td>电话</td>
						<td>货车数量</td>
						<td>发货地址</td>
						<td>收货地址</td>
						<td>订单日期</td>
						<td>订单状态</td>
						<td>总价</td>
						<td>操作</td>
					</tr>
					<#list orderlist as orderlist>

					<tr>
						<td>${orderlist.orderid}</td>
						<#list carlist as carlist>
						<#if orderlist.carid==carlist.id>
						<td id="carname">${carlist.carname}</td>
						
						<#list userlist as userlist>
						<#if orderlist.userid==userlist.userId>
						<td id="username">${userlist.userName}</td>
					
						<td>${orderlist.name}</td>
						<td>${orderlist.phone}</td>
						<td>${orderlist.number}</td>
						<td>${orderlist.faaddress}</td>
						<td>${orderlist.shouaddress}</td>
						<td>${orderlist.data?string("yyyy-MM-dd")}</td>
						<td><#if orderlist.state==1>已完成<#elseif orderlist.state==2>已付款<#elseif orderlist.state==3>待付款</#if>
						
						</td>
						<td>${orderlist.money}</td>
						<td><span  dataid="${orderlist.state}" datacarname="${carlist.carname}" datausername="${userlist.userName}" dataorderid="${orderlist.id}" class="glyphicon glyphicon-edit bianji"
							data-toggle="modal" data-target=".mymodal" data-backdrop="static"></span>
							&nbsp; <a class="removes" dataid="" href="javaScript:;"><span
								class="glyphicon glyphicon-remove color-red "></span></a></td>
					</tr>
						</#if>
						</#list>
						</#if>
						</#list>
					</#list>
				</table>
				<!--列表-->
				<!--右边底部-->
				<div class="r_foot ">
					<div class="r_foot_m ">
						<!--分页-->
						<div class="page ">
							<input type="hidden" id="thisPageNo" />

						</div>
						<!--分页-->
					</div>
				</div>
				</form>
				<!--右边底部-->
			</div>
			<!--会议列表-->
		</div>
	</div>
	<!-- 添加模态框-->
	<div id="modal-add" class="modal fade">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss="modal">&times;</button>
					head-text 标题信息
					<h4 class="head-text text-left">添加顺风车</h4>
				</div>
				<div class="modal-body">
					<form action="/lahuocar/addcar" class="form-horizontal addcar" method="get">
						
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">车辆名称：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="carname" id="carname" value="" />
							</div>
						</div>

						<div class="form-group">
							<span class="col-md-2 text-center margin-top">载重量(吨)：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="load" id="load"
									value="" />
							</div>
						</div>

						<div class="form-group">
							<span class="col-md-2 text-center margin-top">车辆大小：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="lwh" id="lwh"
									value="" />
							</div><span class=" rackCount">((长*宽*高)如：1*1.5*1m)</span>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">车辆容积(方)：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="cubage" id="cubage"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">价格(/里)：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="price" id="price"
									value="" />
							</div>
						</div>
				
				<div class="modal-footer">
					<button class="btn btn-default" data-dismiss="modal">关闭</button>
					<input type="submit" value="保存" class="btn btn-primary" />
				</div>
				
				</form>
				</div>
			</div>
		</div>
	</div>



	<!--模态框-->
	<!-- 修改模态框-->
	<div class="modal fade mymodal">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss="modal">&times;</button>
					<!--head-text 标题信息-->
					<h4 class="head-text text-left">优惠卷详情</h4>
				</div>
				<div class="modal-body">
					<form action="/lahuocar/stateupd" class="form-horizontal update" method="post">

						<input type="hidden" class="grabId" id="id" name="id" value="" />
							<div class="form-group">
							<span class="col-md-2 text-center margin-top">车辆名称：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="carid" id="carid" value="" />
							</div>
						</div>

						<div class="form-group">
							<span class="col-md-2 text-center margin-top">会员名：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="userid" id="userid"
									value="" />
							</div>
						</div>

						<div class="form-group">
							<span class="col-md-2 text-center margin-top">收货人：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="name" id="name"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">电话：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="phone" id="phone"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">货车数量：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="number" id="number"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">发货地址：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="faaddress" id="faaddress"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">收货地址：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="shouaddress" id="shouaddress"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">订单日期：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="data" id="data"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">订单状态：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="state" id="state"
									value="" />
							</div>
						</div>
						<div class="form-group">
							<span class="col-md-2 text-center margin-top">总价：</span>
							<div class="col-md-6">
								<input type="text" class="form-control rackCount"
									name="money" id="money"
									value="" />
							</div>
						</div>
						
		
				
				<div class="modal-footer">
					<button class="btn btn-default" data-dismiss="modal">关闭</button>

					<input  id="bianji" type="submit" value="完成运输" class="btn btn-primary" />

				</div>
				</form>
				</div>
			</div>
		</div>
	</div>
	<!--模态框-->

	<script type="text/javascript " src="/js/jquery-3.2.1.js "></script>
	<script type="text/javascript" src="/js/cityTo.js"></script>
	<script type="text/javascript " src="/js/bootstrap.js "></script>

	<script type="text/javascript " src="/js/layer-v3.1.1/layer/layer.js "></script>
	


	<script type="text/javascript">
		$(function() {
			$(".startProvince").on("change",function() {
						$(".startCity").empty();
						citytoN($(this).val(),".startCity");
					})
			$(".startProvinceO").on("change",function() {
						$(".startCityO").empty();
						citytoN($(this).val(),".startCityO");
					})

			$(".stopProvince").on("change",function() {
						$(".stopCity").empty();
						citytoN($(this).val(),".stopCity");	
					})
			$(".stopProvinceO").on("change",function() {
						$(".stopCityO").empty();
						citytoN($(this).val(),".stopCityO");	
					})
		})
$(".removes").click(function () {
	var obb=$(this);
    var id=obb.attr("dataid");
	$.ajax({
		"url" : "/lahuocar/delcar",
		"type" : "get",
		"data" : 
			{id:id},
		"dataType" : "json",
		success : function(data) {
			if(data>0){
				window.alert("删除成功");
				location.reload();
			}
			else{
				window.alert("修改失败");
				location.href=cxt+"/house/tostorehouseList";
			}
		}
	})
})
$(".bianji").click(function(){
	
	
	var obb=$(this);
    var stateid=obb.attr("dataid");
    var orderid=obb.attr("dataorderid");
    var carname=obb.attr("datacarname");
    var username=obb.attr("datausername");
     if(stateid==3){
    	$("#bianji").css("display","inline");
    }else{
    	
    	$("#bianji").css("display","none");
    }
    
    var statename;
    $.ajax({
		"url" : "/lahuocar/orderupdsel",
		"type" : "get",
		"data" : 
			{id:orderid},
		"dataType" : "json",
		success : function(data) {
			$("#id").val(data.id);
	           $("#carid").val(carname);
	           $("#userid").val(username);
	           $("#name").val(data.name);
	           $("#phone").val(data.phone);
	           $("#number").val(data.number);
	           $("#faaddress").val(data.faaddress);
	           $("#shouaddress").val(data.shouaddress);
	           $("#data").val(data.data);
	           if(data.state==1){
	        	   statename="已完成";
	           }else if(data.state==2){
	        	   statename="已付款";
	           }else{
	        	   statename="待付款";
	           }
	           
	           
	           $("#state").val(statename);
	           $("#money").val(data.money);
		}
	})  
})
	</script>
</body>

</html>